package com.yhy.server.controller;


import com.yhy.domain.Settings;
import com.yhy.server.service.SettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/users")
public class SettingsController {

    @Autowired
    private SettingsService settingsService;

    @GetMapping("/settings")
    public ResponseEntity settings(){
        return settingsService.settings();
    }

    @PostMapping("/questions")
    public ResponseEntity questions(@RequestBody Map map){
        return settingsService.questions(map);
    }

    @PostMapping("/notifications/setting")
    public ResponseEntity notifications(@RequestBody Settings settings){
        return settingsService.notifications(settings);
    }

    @GetMapping("/blacklist")
    public ResponseEntity blacklist(@RequestParam(defaultValue = "1") Integer page,
                                    @RequestParam(defaultValue = "10") Integer pagesize){
        return settingsService.blacklist(page,pagesize);
    }

    @DeleteMapping("/blacklist/{uid}")
    public ResponseEntity deleteBlackList(@PathVariable("uid") Long blackUserId){
        return settingsService.deleteBlackList(blackUserId);
    }
}
